package com.authine.cloudpivot.ext.dto;

import com.alibaba.fastjson.JSON;
import com.authine.cloudpivot.ext.enums.order.StockBillStatusEnum;
import com.authine.cloudpivot.ext.enums.order.StockBillTypeEnum;
import com.authine.mvp.app.launcher.domain.SelectorFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.*;

/**
 * 库存单据
 * Created by Kris on 2019/4/1
 */
@Data
@Schema(description = "StockBillVO")
@ApiModel("库存相关单据表")
public class StockBillVO {
    @Schema(description = "库存相关单据物料集合")
    private List<StockBillMaterialDto> stockBillMaterialVOS;
    @Schema(description = "库存相关单据ID")
    private String id;
    @Schema(description = "库存相关单据ID集合")
    private List<String> ids;
    @Schema(description = "来源单据id")
    private String srcId;//来源单据id
    @Schema(description = "客户id")
    private SelectorFormat customerId;//客户id
    @Schema(description = "供应商Id")
    private SelectorFormat vendorId; // 供应商Id
    @Schema(description = "用户Id")
    private SelectorFormat memberId; // 用户Id
    @Schema(description = "单据类型")
    private String type;//单据类型
    @Schema(description = "单据状态")
    private StockBillStatusEnum stockBillStatus;//单据状态
    @Schema(description = "状态枚举集合")
    private List<StockBillStatusEnum> statusEnumList;
    @Schema(description = "备注")
    private String memo;//备注
    @Schema(description = "审批结果")
    private Boolean isOk;//审批结果
    @Schema(description = "审批意见")
    private String comment;//审批意见
    @Schema(description = "开始时间", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date startTime;
    @Schema(description = "结束时间", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;
    @Schema(description = "客户名称")
    private String customerName;
    @Schema(description = "供应商名称")
    private String vendorName;

    public static Map<String, Object> voToEntity(StockBillVO stockBillVO) {
        Map<String, Object> stockBillMap= new HashMap<>();
        stockBillMap.put("id", stockBillVO.getId());
        stockBillMap.put("src_id", stockBillVO.getSrcId());
        stockBillMap.put("member_id", stockBillVO.getMemberId());
        stockBillMap.put("type", stockBillVO.getType());
        stockBillMap.put("stock_bill_status", stockBillVO.getStockBillStatus().name());
        stockBillMap.put("memo", stockBillVO.getMemo());
        stockBillMap.put("comment", stockBillVO.getComment());
        stockBillMap.put("del", "否");
        return stockBillMap;
    }
}
